﻿using System;
using System.IO;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace PlatformerCS
{
    /// <summary>
    /// Abstract class that represents a living entity.
    /// All enemies and players classes should inherit from it.
    /// </summary>
    public abstract class Entity
    {
        protected Texture2D texture;
        protected Vector2 position;
        protected Rectangle rectangle;
        protected int life;

        /// <summary>
        /// The position of the entity in the world.
        /// </summary>
        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }

        /// <summary>
        /// The life of the entity.
        /// </summary>
        public int Life
        {
            get { return life; }
        }

        /// <summary>
        /// The collision rectangle.
        /// </summary>
        public Rectangle Rectangle
        {
            get { return rectangle; }
            set { rectangle = value; }
        }

        /// <summary>
        /// Inflict damage to the entity.
        /// </summary>
        /// <param name="dmg">The amount of damage.</param>
        public abstract void DealDamage(int dmg);

        /// <summary>
        /// Load the texture of the entity.
        /// </summary>
        /// <param name="content">The game content manager.</param>
        /// <param name="fileName">The name of the texture</param>
        protected void LoadTexture(ContentManager content, string fileName)
        {
            texture = content.Load<Texture2D>(fileName);
        }
    }
}
